From: Tamas K Lengyel Date: Thu, 30 Jan 2014 21:34:16 +0000 (+0100) Subject: mem_event: Return previous value of CR0/CR3/CR4 on change. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~5540 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:///%22http:/www.example.com/cgi/%22https:/?a=commitdiff_plain;h=a93b8e8ca54cc2c90d9272a06d7944d6ca615d42;p=xen.git mem_event: Return previous value of CR0/CR3/CR4 on change. This patch extends the information returned for CR0/CR3/CR4 register write events with the previous value of the register. The old value was already passed to the trap processing function, just never placed into the returned request. By returning this value, applications subscribing the CR events obtain additional context about the event. Signed-off-by: Tamas K Lengyel Acked-by: Tim Deegan --- diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 08fec3425f..9e85c13edb 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -4808,6 +4808,10 @@ static int hvm_memory_event_traps(long p, uint32_t reason, req.gla = gla; req.gla_valid = 1; } + else + { + req.gla = old; + } mem_event_put_request(d, &d->mem_event->access, &req); diff --git a/xen/include/public/mem_event.h b/xen/include/public/mem_event.h index c9ed546500..3831b41bdc 100644 --- a/xen/include/public/mem_event.h +++ b/xen/include/public/mem_event.h @@ -40,9 +40,9 @@ /* Reasons for the memory event request */ #define MEM_EVENT_REASON_UNKNOWN 0 /* typical reason */ #define MEM_EVENT_REASON_VIOLATION 1 /* access violation, GFN is address */ -#define MEM_EVENT_REASON_CR0 2 /* CR0 was hit: gfn is CR0 value */ -#define MEM_EVENT_REASON_CR3 3 /* CR3 was hit: gfn is CR3 value */ -#define MEM_EVENT_REASON_CR4 4 /* CR4 was hit: gfn is CR4 value */ +#define MEM_EVENT_REASON_CR0 2 /* CR0 was hit: gfn is new CR0 value, gla is previous */ +#define MEM_EVENT_REASON_CR3 3 /* CR3 was hit: gfn is new CR3 value, gla is previous */ +#define MEM_EVENT_REASON_CR4 4 /* CR4 was hit: gfn is new CR4 value, gla is previous */ #define MEM_EVENT_REASON_INT3 5 /* int3 was hit: gla/gfn are RIP */ #define MEM_EVENT_REASON_SINGLESTEP 6 /* single step was invoked: gla/gfn are RIP */ #define MEM_EVENT_REASON_MSR 7 /* MSR was hit: gfn is MSR value, gla is MSR address;